package controller

import (
	"fmt"
	"net/http"
	"tiktok2023/model"
	"tiktok2023/service"

	"github.com/gin-gonic/gin"
)

type FeedResponse struct {
	model.Response
	VideoList []VedioTemp `json:"video_list,omitempty"`
	NextTime  int64       `json:"next_time,omitempty"`
}

// Feed same demo video list for every request
func Feed(c *gin.Context) {

	feed := service.FeedService{}
	resp, err := feed.HandleFeedList(c)

	if err != nil {
		c.JSON(http.StatusOK, model.Response{
			StatusCode: 1,
			StatusMsg:  fmt.Sprintf("%v", err),
		})
		return
	}
	c.JSON(http.StatusOK, resp)
}
